package cn.zyjblogs.nio.zerocopy;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class OldIOServer {
    public static void main(String[] args) {
        try(ServerSocket serverSocket = new ServerSocket(7001)) {
            Socket socket = serverSocket.accept();

            DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());
            byte[] byteArray = new byte[4096];
            while (true){
                int read = dataInputStream.read(byteArray, 0, byteArray.length);
                if (-1 == read){
                    break;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
